<template>
	<zkView ref="zkView" v-slot:uContainer>
		<view class="container">
			<view class="address">
				<view class="title">收货信息</view>
				<view class="info" v-if="detail.receive_info">
					<view class="top">
						<text>{{detail.receive_info.name}}</text>
						<text>{{formatPhone(detail.receive_info.phone)}}</text>
					</view>
					<view class="bottom">
						<text>{{`${detail.receive_info.region_str} ${detail.receive_info.address}`}}</text>
					</view>
				</view>
			</view>
			<view class="orderInfo">
				<view :class="`status ${loaded}`">{{["", "待付款", "待发货", "已发货", "已收货", "已失效", "已退款", "已取消"][detail.status]}}
				</view>
				<view class="title">订单信息</view>
				<block v-if="proList&&proList.length>0">
					<block v-for="(pro, index) in proList" :key="index">
						<view class="productItem" v-if="pro.productInfo&&pro.spuInfo">
							<view class="itemLeft">
								<image mode="aspectFit" :src="pro.productInfo.thumb || '/static/placeholder.png'"></image>
							</view>
							<view class="itemRight">
								<view class="name">{{pro.productInfo.name}}</view>
								<view class="priceNum">
									<view class="price">
										<text>￥</text>
										<text v-if="$store.state.login.role===1">{{formatPrice(pro.spuInfo.price_active)}}</text>
										<text v-if="$store.state.login.role===2">{{formatPrice(pro.spuInfo.price_vip)}}</text>
										<text v-if="$store.state.login.role===9">{{formatPrice(pro.spuInfo.price_vip)}}</text>
										<text>￥</text>
										<text>{{formatPrice(pro.spuInfo.price_original)}}</text>
									</view>
									<view class="num">
										<text>x{{pro.count}}</text>
									</view>
								</view>
							</view>
						</view>
					</block>
				</block>
				<view class="infoItem">
					<view class="itemLeft">商品数</view>
					<view class="itemRight">{{detail.total_count}}件</view>
				</view>
				<view class="infoItem">
					<view class="itemLeft">商品总价</view>
					<view class="itemRight">￥{{formatPrice(detail.total_money)}}</view>
				</view>
				<view class="infoItem">
					<view class="itemLeft">商品优惠</view>
					<view class="itemRight txtGold" v-if="$store.state.login.role===1">
						减￥{{formatPrice(detail.active_discount)}}</view>
					<view class="itemRight txtGold" v-if="$store.state.login.role===2">
						减￥{{formatPrice(detail.vip_discount)}}</view>
					<view class="itemRight txtGold" v-if="$store.state.login.role===9">
						减￥{{formatPrice(detail.vip_discount)}}</view>
				</view>
				<view class="infoItem">
					<view class="itemLeft">优惠券</view>
					<view class="itemRight txtGold">减￥{{formatPrice(detail.ticket_discount)}}</view>
				</view>
				<view class="infoItem">
					<view class="itemLeft">会员九折优惠</view>
					<view class="itemRight goldBtn" v-if="$store.state.login.role===1">--</view>
					<view class="itemRight txtGold" v-else>减￥{{formatPrice(detail.vip90_discount)}}</view>
				</view>
				<view class="infoItem">
					<view class="itemLeft txtGold">共减</view>
					<view class="itemRight txtGold">￥{{formatPrice(detail.total_discounttotal_discount)}}</view>
				</view>
				<view class="infoItem">
					<view class="itemLeft txtRed">实际支付</view>
					<view class="itemRight txtRed" v-if="detail.pay_money">￥{{formatPrice(detail.pay_money)}}</view>
					<view class="itemRight txtRed" v-else>￥{{formatPrice(detail.need_money)}}</view>
				</view>

				<view class="infoItem">
					<view class="itemLeft">订单编号</view>
					<view class="itemRight">{{detail._id}}</view>
				</view>
				<view class="infoItem">
					<view class="itemLeft">交易号</view>
					<view class="itemRight" v-if="detail.notify_info">{{detail.notify_info.transactionId}}</view>
					<view class="itemRight txtRed" v-else>--</view>
				</view>
				<view class="infoItem">
					<view class="itemLeft">创建时间</view>
					<view class="itemRight">{{formatDate(detail.create_time)}}</view>
				</view>
				<view class="infoItem">
					<view class="itemLeft">支付时间</view>
					<view class="itemRight">{{formatDate(detail.pay_time)}}</view>
				</view>
				<view class="infoItem">
					<view class="itemLeft">积分</view>
					<view class="itemRight">+10</view>
				</view>
			</view>

			<view class="fixBottom">
				<view class="fbLeft">
					<uni-icons type="chatbubble" size="44rpx" @click=""></uni-icons>
					<text>客服</text>
				</view>
				<view class="fbRight">
					<view class="actionBtn grayBtn" v-if="detail.status==='1'||detail.status==='2'"
						@click.stop="cancelOrder(this.detail)">
						<text>取消订单</text>
					</view>
					<view class="actionBtn redBtn" v-if="detail.status==='1'" @click.stop="payOrder(this.detail)">
						<text>立即支付</text>
					</view>
					<view class="actionBtn blueBtn" v-if="['3'].indexOf(detail.status)>=0" @click.stop="getDelivery(this.detail)">
						<text>查看物流</text>
					</view>
					<view class="actionBtn blueBtn" v-if="['3'].indexOf(detail.status)>=0" @click.stop="onReceived(this.detail)">
						<text>收到货了</text>
					</view>
					<view class="actionBtn grayBtn" v-if="['4'].indexOf(detail.status)>=0" @click.stop="toService(this.detail)">
						<text>我要售后</text>
					</view>
				</view>
			</view>
		</view>
	</zkView>
</template>

<script>
	import indexJs from './index.js';
	import mixins from '@/common/mixins.js';
	export default {
		components: {

		},
		mixins: [mixins],
		...indexJs
	};
</script>

<style lang="scss" scoped>
	@import './index.scss';
</style>